gadget: Be more forgiving to size inconsistencies
authorMatthias Clasen <mclasen@redhat.com>
Fri, 4 Dec 2015 12:52:18 +0000 (07:52 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 15 Dec 2015 13:41:16 +0000 (08:41 -0500)
Instead of asserting if we hit negative content sizes,
warn and continue. This is easier to work with in this
transition period.

gtk/gtkcssgadget.c

index de8641810d46c6aff3c939708a44a66fa43cada7..60bb9d2a8cbfb995c99d6ce00c6517c23b36d356 100644 (file)
@@ -451,8 +451,17 @@ gtk_css_gadget_allocate (GtkCssGadget        *gadget,
   if (baseline >= 0)
     baseline += extents.top;
 
-  g_assert (content_allocation.width >= 0);
-  g_assert (content_allocation.height >= 0);
+  if (content_allocation.width < 0)
+    {
+      g_warning ("Negative content width while allocating gadget\n");
+      content_allocation.width = 0;
+    }
+
+  if (content_allocation.height < 0)
+    {
+      g_warning ("Negative content height while allocating gadget\n");
+      content_allocation.width = 0;
+    }
 
   GTK_CSS_GADGET_GET_CLASS (gadget)->allocate (gadget, &content_allocation, baseline, &content_clip);